<template>
  <div class="contentBox">
    <h2 class="title">我的歌手({{ dataArr.length }})</h2>
    <ul>
      <li
        @click="jumpUrl(item.id, item.name)"
        class="itemBox"
        v-for="item in dataArr"
        :key="item.id"
      >
        <img :src="item.picUrl" class="picImg" alt="" />
        <div class="itemRight">
          <h3 class="itemName txtHide">{{ item.name }}</h3>
          <span class="itemTe"> {{ item.albumSize }}个专辑</span>
          <span class="itemTe"> {{ item.mvSize }}个MV</span>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { liveSinger } from "@/api";
export default {
  data() {
    return {
      dataArr: [],
    };
  },
  created() {
    this.getUserData();
  },
  methods: {
    getUserData() {
      liveSinger().then((res) => {
        this.dataArr = res.data;
      });
    },
    jumpUrl(id, name) {
      let { href } = this.$router.resolve({
        name: "singerdetail",
        query: { id, name },
      });
      window.open(href, "_blank");
    },
  },
};
</script>

<style lang="scss" scoped>
.contentBox {
  padding-top: 40px;
  .title {
    font-size: 24px;
    font-weight: normal;
    height: 40px;
    border-bottom: 2px solid #c20c0c;
  }
  .itemBox {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    .picImg {
      margin-right: 15px;
      width: 80px;
      height: 80px;
    }
    .itemRight {
      overflow: hidden;
      .itemName {
        color: #333;
        height: 21px;
        margin: 10px 0;
        line-height: 21px;
        font-size: 16px;
      }
      .itemTe {
        color: #666;
        margin-right: 15px;
      }
    }
  }
}
</style>